package com.wanma.recuit.service.impl;


import com.github.pagehelper.PageInfo;
import com.wanma.recuit.mapper.CompanyMapper;
import com.wanma.recuit.mapper.CompanyUserMapper;
import com.wanma.recuit.mapper.UserMapper;
import com.wanma.recuit.pojo.Company;
import com.wanma.recuit.pojo.CompanyUser;
import com.wanma.recuit.pojo.User;
import com.wanma.recuit.service.LoginRegistService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class LoginRegistServiceImpl implements LoginRegistService {
    @Resource
    private CompanyUserMapper companyUserMapper;
    @Resource
    private UserMapper userMapper;
    @Resource
    private CompanyMapper companyMapper;
    //检查公司是否有该手机号码
    public String findUserPhone(String userPhone){

       return userPhone = companyUserMapper.findUserPhone(userPhone);
    }
    //注册公司用户
    public CompanyUser registCompanyUser(CompanyUser companyUser){
         companyUserMapper.registCompanyUser(companyUser);
        return companyUser;
    }
    //查看公司用户的手机号和密码是否正确然后登陆
    public CompanyUser loginCompanyUser(CompanyUser companyUser){
        return  companyUserMapper.loginCompanyUser(companyUser);
    }
    //查看应聘者手机号是否注册过
    public  String findPhone(String phone){
        return userMapper.findPhone(phone);
    }
    //注册应聘者用户
    public User registUser(User user){
        userMapper.registUser(user);
        return user;
    }
    //应聘者登陆
    public User loginUser(User user){
        return userMapper.loginUser(user);
    }
    //去查询公司的所有信息并返回
    public Company getCompany(CompanyUser companyUser){ return companyMapper.getCompany(companyUser);};






    @Override
    public void insert(CompanyUser object) {

    }

    @Override
    public void delete(Integer id) {

    }

    @Override
    public void delete(String ids) {

    }

    @Override
    public void update(CompanyUser object) {

    }

    @Override
    public CompanyUser findById(Integer id) {
        return null;
    }

    @Override
    public List<CompanyUser> findAll() {
        return null;
    }

    @Override
    public PageInfo<CompanyUser> findPage(int pageNum, int pageSize) {
        return null;
    }
}
